//
//  DetailsHeadView.m
//  TodatPlay
//
//  Created by dllo on 16/9/6.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "DetailsHeadView.h"
#import "SDAutoLayout.h"
#import "UIView+Frame.h"
@implementation DetailsHeadView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createContents];
        self.picImageView.contentMode = UIViewContentModeScaleAspectFill;
        _picImageView.clipsToBounds = YES;
    }
    return self;
}
- (void)createContents {
    self.picImageView = [UIImageView new];
    UIImageView *picImageView = [UIImageView new];
    self.titleLabel = [UILabel new];
    self.pricestrLabel = [UILabel new];
    
    
    [self addSubview:_pricestrLabel];
    [self addSubview:_picImageView];
    [self addSubview:picImageView];
    [self addSubview:_titleLabel];
    
    
    _picImageView.image = [UIImage imageNamed:@"2"];
    picImageView.image = [UIImage imageNamed:@"0"];
    _titleLabel.text = @"博物馆的奇妙夜与恐龙相邻而睡{亲子活动}";
    _pricestrLabel.text = @"60元";
    
    _titleLabel.font = [UIFont systemFontOfSize:19];
    _pricestrLabel.font = [UIFont systemFontOfSize:18];
        
    _pricestrLabel.textColor = [UIColor colorWithRed:0.977 green:0.000 blue:0.033 alpha:1.000];
       
    _picImageView.sd_layout
    .topSpaceToView(self, 0)
    .leftEqualToView(self)
    .rightEqualToView(self)
    .heightIs(self.dm_height * 2 / 3);
    
    picImageView.layer.cornerRadius = 20;
    picImageView.layer.masksToBounds = YES;
    
    picImageView.sd_layout
    .rightSpaceToView(self, 20)
    .topSpaceToView(_picImageView, -20)
    .widthIs(40)
    .heightIs(40);
    
    _titleLabel.sd_layout
    .topSpaceToView(_picImageView, 25)
    .leftSpaceToView(self, 10)
    .rightSpaceToView(self, 80)
    .autoHeightRatio(0);
    
    _pricestrLabel.sd_layout
    .leftSpaceToView(self, 10)
    .topSpaceToView(_titleLabel, 15)
    .rightSpaceToView(self, 80)
    .autoHeightRatio(0);
    
    [self setupAutoHeightWithBottomView:_pricestrLabel bottomMargin:10];
    
  }

@end
